home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-04-16 | 1.5 KB | 76 lines | [TEXT/CWIE] |
- // KoreanTokenizer.h
- // Copyright: © 1996 -1998 by Apple Computer, Inc., all rights reserved.
-
- #pragma once
- #ifndef KoreanTokenizer_h
- #define KoreanTokenizer_h
-
- #pragma import on
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=power
- #endif
-
- #include <Script.h> // Macintosh platform specific include
-
- #include "IAAnalysis.h"
- #include "IACharStream.h"
-
- #pragma IA_BEGIN_EXPORTS
-
- class KoreanDoubleByteChar
- {
- public:
- KoreanDoubleByteChar(IACharStream* stream) :
- code(0), len(0), kind(0),
- fCharStream(stream), fScript(smKorean) {}
- ~KoreanDoubleByteChar() {}
- OSErr GetNextDBChar();
- short EndOfFile();
- UInt32 GetCurrentPos() {return fCharStream->CurrentPos();}
-
- UInt16 code;
- UInt8 len;
- UInt8 kind;
- UInt32 fScript;
- IACharStream* fCharStream;
- };
-
- class KoreanTokenizer : public IATokenStream
- {
- public:
- KoreanTokenizer(IACharStream* stream);
- ~KoreanTokenizer(); // deletes fCharStream
-
- IAToken* GetNextToken();
- void GetTextSpan(byte* buffer, uint32 startPos, uint32 endPos);
-
- enum KoreanTypes { kAlphaNumeric = 0, // Allowed anywhere in a token
- kTokenPunctuation = 1, // [,.] Allowed embedded in a token
- kPunctuation = 2, // Not allowed anywhere in a token
- kWhiteSpace = 3 // Not allowed anywhere in a token
- };
-
-
- private:
-
-
- IACharStream* fCharStream;
- IAToken* GetNextTokenInternal();
- bool BuildNextToken(StringPtr token, UInt32* startPos, UInt32* endPos);
- KoreanDoubleByteChar* fDBChar;
- char* buffer;
-
- };
-
-
- #pragma IA_END_EXPORTS
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #endif
-
- #pragma import reset
-
- #endif
-